//
//  ViewController.m
//  AntsExpress
//
//  Created by slccper on 16/1/1.
//  Copyright © 2016年 slccper. All rights reserved.
//

#import "ViewController.h"
#import "clsOtherFun.h"
#import "clsAntsService.h"
#import "MainViewController.h"
#import "AppDelegate.h"
#import "CustomNavigation.h"
@interface ViewController ()<clsAntsServiceDelegate>
{
}
@property (nonatomic,strong)clsAntsService *ants;
@property (nonatomic,strong)UIImageView *bgview;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.ants = [[clsAntsService alloc]init];
    self.ants.delegate=self;
    self.view.backgroundColor = [UIColor whiteColor];
    [self getWebData];
    self.bgview = [[UIImageView alloc]initWithFrame:self.view.frame];
    self.bgview.image=[clsOtherFun createImageWithColor:[UIColor whiteColor]];
    [self.view addSubview:self.bgview];
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)getWebData
{
    if ([clsOtherFun CheckNetworkStatus:YES]) {
//        [clsOtherFun showLoadingView:@"正在獲取數據"];
        [self.ants GetSlideBox];
    }
}
-(void)getAntsDataFail:(NSInteger)type
{
    [clsOtherFun hideLoadingView];
    MainViewController *main = [[MainViewController alloc]init];
//    main.bannerList =_bannerList;
    CustomNavigation *nav = [[CustomNavigation alloc]initWithRootViewController:main];
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    app.window.rootViewController = nav;
}
-(void)getAntsDataSuccess:(NSInteger)type :(NSMutableDictionary *)pDictionary
{
    [clsOtherFun hideLoadingView];
    NSMutableArray *_bannerList = [pDictionary objectForKey:@"data"];
    MainViewController *main = [[MainViewController alloc]init];
    main.bannerList =_bannerList;
    CustomNavigation *nav = [[CustomNavigation alloc]initWithRootViewController:main];
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    app.window.rootViewController = nav;
}
-(void)dealloc
{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
